home *** CD-ROM | disk | FTP | other *** search
- Path: nnrp.info.ucla.edu!jmartin
- From: jmartin@cs.ucla.edu (Jay Martin)
- Newsgroups: comp.lang.eiffel,comp.lang.c,comp.lang.c++,comp.object,comp.software-eng
- Subject: Re: Portability of code & skills (Beware of "C" Hackers etc)
- Date: 26 Mar 1996 06:01:11 GMT
- Organization: University of California, Los Angeles
- Message-ID: <4j8177$18ma@saba.info.ucla.edu>
- References: <31494D29.4D4B@dmu.ac.uk> <DoG3HE.48E@assip.csasyd.oz> <31517E6F.5930@dmu.ac.uk> <DooBwC.8C0@world.std.com> <65O34-3-3RB@herold.franken.de>
- NNTP-Posting-Host: may.cs.ucla.edu
- X-Newsreader: NN version 6.5.0.b3.0 #9 (NOV)
-
- jhd@herold.franken.de (Joachim Durchholz) writes:
-
- >tej@world.std.com wrote 22.03.96 on Re: Portability of code & skills (Beware of "C" Hackers etc):
-
- >> I don't remember enough Pascal to know what you mean. I know you could
- >> define a function inside a function, making Pascal block-structured.
- >> C can't do that, but of course you can pass functions as arguments of
- >> functions.
-
- >The power of this mechanism is that the local function can access local
- >variables of its surrounding function. E.g. in a list processing
- >environment you could write
-
- > function CountThem (l: List): integer;
- > var Count: integer
- > procedure CountOne (e: ListElement);
- > begin
- > if <some condition on e fulfilled> then begin
- > Count := Count + 1;
- > end;
- > end;
- > begin
- > ApplyOnList (l, CountOne); (* !!!! *)
- > CountThem := Count
- > end;
-
-
- This is what I call side-effects on a global variable (or variable of
- a larger scope). Its not what I call good programming practice. In
- fact, I see nested procedures as implemented in algol block languages
- (automatic importation of variables from larger scopes) as another
- stupid idea of CS.
-
- Jay
-
-
-
-
-
-